package com.berry.MedCheck;

import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;

/**
 * Created with IntelliJ IDEA.
 * User: Airay.Rong
 * Date: 13-12-4
 * Time: 下午1:18
 * To change this template use File | Settings | File Templates.
 */
public class Utils {
	public static final String TAG1 = "btchecking";
	public static final String TAG2 = "btService";
	public static final String TAG3 = "medcheck";

	public static final String PREFERENCE_NAME = "pre";
	public static final String PRE_KEY_CURRENT_USER_ID= "current_id";
	public static final String PRE_KEY_CURRENT_GUILD= "guild";
	public static final int INTENT_RESULT_BTSETTING = 2000;
	public static final int INTENT_RESULT_BTSEARCH = 3000;
	public static final int INTENT_RESULT_BTDISCOVERTIME = 4000;
	public static final int BT_DISCOVER_TIME = 300;
	public static final String EXTRA_DEVICE_ADDRESS = "device_address";
	public static final String EXTRA_DEVICE_NAME = "device_name";

	public static final String INTENT_PARA_SPO2 = "spo2";
	public static final String INTENT_PARA_PR = "pr";
	public static final String INTENT_PARA_PI = "pi";
	public static final String INTENT_PARA_DATE = "date";
	public static final String INTENT_PARA_USER_ID = "user_id";

	public static final String INTENT_ACK_SHOW_DATA = "show_data";
	public static final String INTENT_ACK_UPDATE_DATA = "update_data";
	public static final String INTENT_ACK_CHOOSE_BT_CANCEL = "choose_bt_cancel";
	public static final String INTENT_ACK_CHOOSE_BT_DONE = "choose_bt_done";
	public static final String INTENT_ACK_CLOSE_BT_SEARCH = "close_bt_search";

	public static final String SPO2_DEVICE_NAME = "Bonzer";
	public static final String SPO2_DEVICE_PASSWORD = "0000";
	public static final int  DB_RECORD_WINDOW = 10*1000;

	public static final int  DATA_SPO2_MAX = 100;
	public static final int  DATA_SPO2_MIN = 35;
	public static final int  DATA_SPO2_NONE = 127;

	public static final int  DATA_PR_MAX = 250;
	public static final int  DATA_PR_MIN = 25;
	public static final int  DATA_PR_NONE = 255;

	public static final int  DATA_PI_MAX = 20;
	public static final int  DATA_PI_MIN = 0;
	public static final int  DATA_PI_NONE = 15;
	public static final int  GRAPHY_POINT_NUM = 10;

	public static final int HANDLE_MSG_EXPORT_DONE = 10;
	public static final int HANDLE_MSG_EXPORT_FAIL = 11;

	public static String getTime(Long aLong) {
		if (aLong == 0) {
			return " ";
		}
		SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss");
		return sdf.format(new Date(aLong));
	}
	public static String getFullDate(Long aLong) {
		if (aLong == 0) {
			return " ";
		}
		SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
		return sdf.format(new Date(aLong));
	}

	public static String getMonth(Long dateValue) {
		if (dateValue == 0) {
			return " ";
		}
		SimpleDateFormat sdf=new SimpleDateFormat("MMM");
		return sdf.format(new Date(dateValue));
	}
}
